<template>
  <div class="page">
    <div class="hei20"></div>
    <div class="noticeWrapper">
      <div class="noticeTitle">
        <!-- 关于网格化管理推进工作公告 -->
        {{detail.title}}
      </div>
      <div class="noticeDate"><span>发布时间：</span>{{publishDate}} <span>&nbsp;&nbsp;&nbsp;发布人：</span>{{detail.publisher}}</div>
      <div class="noticeContainer">
        <div class="noticeMain">
          <!-- 经过一条长长隧道,就能够感觉到风了,温柔的风啊或是热烈的风啊,哪怕只属于我的轻轻的微风,
          阳光和泥土的味道和雨水的味道,混合着呼啸着吹向我疼痛又快乐的是成长的味道吗?
          风吹过干枯沙漠,轻拂过潮湿海边,
          风吹干我脸上的眼泪,吹出了笑脸,
          风吹干我脸上的眼泪,吹出了笑脸,
          被风吹散过能抱更紧了 -->
          {{detail.content}}
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import Lib from '@/assets/js/Lib'
import { getNoticeDetail } from '@/assets/js/ApiUtil'
import { setTimes } from '@/assets/js/Utils'
export default {
  name: 'noticeDetail',
  data () {
    return {
      title: '通知详情',
      detail: {}
    }
  },
  components: {
  },
  mounted () {
    let id = this.getQueryVariable('id')
    this.getNoticeData(id)
  },
  methods: {
    getQueryVariable (variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      for (var i = 0; i < vars.length ; i++) {
          var pair = vars[i].split("=");
          if(pair[0] === variable){
            return pair[1]
          }
      }
    },
    getNoticeData (id) {
      getNoticeDetail(id).then(resp => {
        if (resp.code && resp.code === '200') {
          let data = resp.data
          this.detail = data
        }
      })
    }
  },
  computed: {
    publishDate () {
      if (this.detail.createTime) {
        return setTimes(this.detail.createTime)
      } else {
        return ''
      }
    }
  }
}
</script>
<style scoped>
.page {
  width: 100%;
  height: 100%;
  background: #f5f5f5;
  overflow: hidden;
}
.noticeWrapper {
  padding:0 20px
}
.noticeTitle {
  margin-bottom: 15px;
  font-size: 22px;
  font-weight: bold;
  color: #333;
  text-align: center
}
.noticeDate {
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #dbdbdb;
  color: #666;
  font-size: 12px
}
.noticeMain {
  font-size: 13px;
  line-height: 170%
}
.noticeMain p {
  font-size: 13px;
  line-height: 170%
}
</style>
